package server;

import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import rmi.Server;
import rmi.Server_Servant;
//import java.rmi.server.UnicastRemoteObject;
public class TecBoxServer {

	public static void main(String args[]){
		    try{
	            
	            if (args[0].equals("Primary")) {
	            	Server tecBoxserver = new Server_Servant("Backup", "127.0.0.1");
	            	Naming.rebind("//localhost/TecBox_PrimaryServer", tecBoxserver);
	            }
	            else {
	            	Server tecBoxserver = new Server_Servant("Primary", "127.0.0.1");
	            	Naming.rebind("//localhost/TecBox_BackupServer", tecBoxserver);
	            }
	            System.out.println(args[0] + "Server ready ");
	        }catch(Exception e) {
	            System.out.println("Server main " + e.getMessage());
	        }
	}
	
}
